const path = require('path')
const { VueLoaderPlugin } = require('vue-loader');
const htmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack')
module.exports = {
    entry:"./src/main.js",
    output:{
        filename:"bundle.js",
        path:path.resolve(__dirname,'dist')
    },
    module:{
        rules:[
            {
                test:/\.(png|jpg|gif)$/,
                use:[
                    {
                        loader:"url-loader",
                        options: {
                            limit:8192,
                            esModule:false
                        }
                    }
                ],
                // type:'javascript/auto'
                
            },
            // {
            //     test:/\.(png|jpg|gif)$/,
            //     use:[{
            //         loader:"file-loader",
            //         options:{
            //             esModule:false
            //         }
            //     }]
            // },
            {
                test:/\.less$/,
                use:[
                    "vue-style-loader",
                    "css-loader",
                    "less-loader"
                ]
            },
            {
                test:/\.js$/,
                exclude:/node_modules/,
                use:[{
                    loader:'babel-loader',
                    options:{
                        presets:["@babel/preset-env"]
                    }
                }]
            },
            {
                test:/\.vue$/,
                use:["vue-loader"]
            },
            {
                test: /\.css$/,
                use: [
                  'vue-style-loader',
                  'css-loader'
                ]
              }
        ]
    },
    plugins:[
        new VueLoaderPlugin(),
        new htmlWebpackPlugin({
            template:'./public/index.html',
            title:"cc"
        }),
        new webpack.DefinePlugin({
            BASE_URL:JSON.stringify('/')
        })
    ]
}